<?php
class AdmcontentAction extends admCommonAction
{
	/**
	 * @var contentLib
	 */
	private $contentLib;
	
	function __construct()
	{
		parent::__construct();
		$this->contentLib=new contentLib();
	}
	
	public function addContent()
	{
		if($_POST)
		{
			$title=$this->checkForm('title','post','标题长度错误', array(wsForm::$string,1,100));
			$content=$this->checkForm('content','post','内容长度错误', array(wsForm::$string,1,wsForm::$intMax));
			$tag=$this->checkForm('tag','post','标签长度错误', array(wsForm::$string,1,30));
			$catalog=$this->checkForm('catalog','post','栏目ID错误', array(wsForm::$intArr,1,wsForm::$intMax));
			$contentId=$this->contentLib->addContent($title, $content);
			if($contentId)
			{
				$catalogLib=new catalogLib();
				$catalogLib->addCatalog($catalog, $contentId);
			}
		}
		$menuLib=new menuLib();
		$meueList=$menuLib->getMenuList();
		$this->loadView('add_content',array('menuList'=>$meueList));
	}
}